#ifndef _LIB_USER_SYSCALL_HANDLER_H_
#define _LIB_USER_SYSCALL_HANDLER_H_

#include "stdint.h"

#define SYSCALL_NR 32

enum syscall_nr_t
{
  SYS_GETPID,
  SYS_WRITE,
  SYS_MALLOC,
  SYS_FREE,
  SYS_OPEN,
  SYS_CLOSE,
  SYS_READ,
  SYS_LSEEK,
  SYS_UNLINK,
  SYS_MKDIR,
  SYS_OPENDIR,
  SYS_CLOSEDIR,
  SYS_READDIR,
  SYS_REWINDDIR,
  SYS_RMDIR,
  SYS_GETCWD,
  SYS_CHDIR,
  SYS_STAT,
  SYS_FORK,
  SYS_PUTCHAR,
  SYS_CLEAR,
  SYS_PS,
  SYS_EXECV,
  SYS_WAIT,
  SYS_EXIT,
  SYS_PIPE,
  SYS_FD_REDIRECT,
  SYS_HELP
};

/**
 * @brief Get the process ID (PID) of the current process.
 * @return The PID of the current process.
 */
uint32_t getpid();

/**
 * @brief Write a string to the console.
 *
 * This function writes the given string to the output device.
 *
 * @param str Pointer to the string to be written.
 * @return The number of characters written, or an error code if the write
 * operation fails.
 */
uint32_t write(char* str);

/**
 * @brief Allocate memory from the system memory pool.
 *
 * This function allocates a contiguous block of memory from the memory pool.
 *
 * @param cnt The size (in bytes) of the memory block to allocate.
 * @return Pointer to the allocated memory block, or NULL if allocation fails.
 */
uint32_t malloc(uint32_t cnt);

void free(void* ptr);

#endif
